from addon.Sway.Sway import Sway
from lib.ZButton import ZButton
from lib.res.fun import _create_sound
from lib.res.glo import SRC


class EnemyBtn ( ZButton ) :
	def __init__ ( self , father , surface_in , surface_out , size , enemy ) :
		super ( EnemyBtn , self ).__init__ ( father , surface_in , surface_out , size )
		self.enemy = enemy
		self.clicksound = _create_sound ( SRC [ 'sound' ] [ 'attack' ] )

	def _action ( self ) :
		attack_action = Sway ( self.father , self.image )
		attack_action._running = True
		self.father.father.father._add ( attack_action )
		self.clicksound.play ( )
		from resource.ui.sces import players
		players [ 0 ]._hit_enemy ( self.enemy )
